﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Edu.Console
{
    /// <summary>
    /// Data 
    /// </summary>
    public class Data
    {
        public int Value { get; set; }
        
        public override string ToString()
        {
            return Value.ToString();
        }

        /// <summary>
        /// The sum
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static int Add(int x, ref int y)
        {
            y = 10;
            return x + y;
        }

        /// <summary>
        /// The sum with mod "ref" and default params
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="w"></param>
        /// <returns></returns>
        public static int Add(int x, ref int y, int z = 100, int w = 200)
        {
            y = 10;
            return x + y + z + w;

        }

        /// <summary>
        /// The sum with mod "ref"
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static int Add(Data x, ref Data y)
        {
            x = new Data { Value = 5 };
            y = new Data { Value = 10 };

            return x.Value + y.Value;
        }
        
        /// <summary>
        /// The sum with mod "out"
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="Res"></param>
        public static void Add(Data x, Data y, out Data Res)
        {
            Res = new Data { Value = x.Value + y.Value };
        }
    }
}
